package com.woniuxy.rabbitmqspringboot.dead;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Author zhangyong
 * @Date 2021/8/12 0012下午 3:32
 */
@Component
public class DeadProductor {

    @Resource
    private AmqpTemplate amqpTemplate;

    public void send(String data){
        //向延迟交换机发送消息
        System.out.println("生产者发送消息的时间："+new Date());
        amqpTemplate.convertAndSend("delay_exchange","delay",data);
    }
}
